package com.sunsys.hdfs;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IOUtils;

public class DisplayHdfsFileContent {

	public static void main(String []args) {
		
		FileSystem fileSystem = null;
		Configuration configuration = null;
		String hdfsFilePath = "/usr/WeatherData/Temperature.txt"; 
		configuration = new Configuration();
		try {
			fileSystem = FileSystem.get(configuration);
			
			String src = "/home/ubuntu/Desktop/Suspected List.txt";
			String src2 = "/home/ubuntu/Desktop/Suspected List2.txt";
			String dest = "/usr/WeatherData/";
			fileSystem.copyFromLocalFile(false, new Path(src), new Path(src2));
			
			//FSDataInputStream hdfsFileInputStream =  fileSystem.open(new Path(hdfsFilePath));
			
//			IOUtils.copyBytes(hdfsFileInputStream, System.out, configuration);
			
		}catch(IOException e1) {
			e1.printStackTrace();
		}
//		catch(URISyntaxException e2){
//			e2.printStackTrace();
//		}
		
		System.out.println("Thanks you");
	}
}
